<template>
  <div>
    <a-card>
      <a-row style="margin-bottom: 10px">
        <a-col :span="24"  style="display: flex;flex-direction: row-reverse">
          <a-button v-print="'#printReport'" type="primary">打印报表</a-button>
        </a-col>
      </a-row>
      <div id="printReport">
        <table border="1" cellPadding="5" cellSpacing="0" bordercolor="#000" style="width: 100%">
        <tr>
          <th colspan="9">
            <div style="position: relative;text-align: center">
              <img src="@/assets/reportIcon.png" width="100px" height="30px" style="position: absolute;left: 0px;top:-5px"/>
              <span>IQC来料检验报告</span>
            </div>
          </th>
        </tr>
        <tr>
          <td colspan="9">
            <a-row>
              <a-col :span="8"><span>来料日期：{{ reportData.inDate }}</span></a-col>
              <a-col :span="8"><span>检验日期：{{ reportData.inspectionDate }}</span></a-col>
              <a-col :span="8"> <span>来料单号：{{ reportData.inMaterialNum }}</span></a-col>
            </a-row>
          </td>
        </tr>
        <tr>
          <td colspan="9">
            <div style="display:flex;justify-content: space-around;pointer-events: none;">
              <a-radio-group v-model="reportData.inMaterialType" :options="checkedList"/>
            </div>
          </td>
        </tr>
        <tr>
          <td align="center">物料编号</td>
          <td align="center" colspan="2">物料名称</td>
          <td align="center">来料数量</td>
          <td align="center">抽样数量</td>
          <td align="center">原值</td>
          <td align="center">测试值</td>
          <td align="center">来料批次</td>
          <td align="center">供应商名称</td>
        </tr>
        <tr>
          <td>{{reportData.materialinfo.materialId}}</td>
          <td colspan="2">{{reportData.materialinfo.materialName}}</td>
          <td>{{reportData.materialinfo.inNum}}</td>
          <td>{{reportData.materialinfo.samplesNum}}</td>
          <td>{{reportData.materialinfo.origValue}}</td>
          <td>{{reportData.materialinfo.testValue}}</td>
          <td>{{reportData.materialinfo.inBatch}}</td>
          <td>{{reportData.materialinfo.supName}}</td>
        </tr>
        <tr>
          <td colspan="4" rowspan="2"> 1.AQL收货标准：MIL-STD-105E(Ⅱ）</td>
          <td colspan="2" rowspan="2" align="center">允收水准</td>
          <td>致命缺陷</td>
          <td>严重缺陷</td>
          <td>轻微缺陷</td>
        </tr>
        <tr>
          <td>CR:0.65</td>
          <td>MAJ:2.5</td>
          <td>MIN:4.0</td>
        </tr>
        <tr>
          <td colspan="4" rowspan="2"> 2.检验员依据：《来料检验程序文件》</td>
          <td colspan="2" align="center">允收数</td>
          <td>AC:{{reportData.materialinfo.accepNum1}}</td>
          <td>AC:{{reportData.materialinfo.accepNum2}}</td>
          <td>AC:{{reportData.materialinfo.accepNum3}}</td>
        </tr>
        <tr>
          <td colspan="2" align="center">拒收数</td>
          <td>RE:{{reportData.materialinfo.rejectionNum1}}</td>
          <td>RE:{{reportData.materialinfo.rejectionNum2}}</td>
          <td>RE:{{reportData.materialinfo.rejectionNum3}}</td>
        </tr>
        <tr>
          <td colspan="4"> 3.是否有HSF标示</td>
          <td colspan="5">
            <div style="display:flex;justify-content: space-around;pointer-events: none;">
              <a-radio-group v-model="reportData.materialinfo.hsrfLabeling" :options="hsf"/>
            </div>
          </td>
        </tr>
        <tr>
          <td colspan="5" rowspan="2" align="center">缺陷描述</td>
          <td rowspan="2">不良品数量</td>
          <td>致命</td>
          <td>严重</td>
          <td>轻微</td>
        </tr>
        <tr>
          <td>CR</td>
          <td>MAJ</td>
          <td>MIN</td>
        </tr>
        <tr v-for="(item,index) in reportData.defectlist" :key="index">
          <td align="center">{{ item.defectTypeName }}</td>
          <td colspan="4">{{ item.defectDesc }}</td>
          <td>{{ item.defectNum }}</td>
          <td>{{ item.rejectsNum1 }}</td>
          <td>{{ item.rejectsNum2 }}</td>
          <td>{{ item.rejectsNum3 }}</td>
        </tr>
        <tr>
          <td colspan="5">
            <div style="display:flex;justify-content: space-around;pointer-events: none;">
              <a-radio-group v-model="reportData.materialinfo.isQualified" :options="qualified"/>
            </div>
          </td>
          <td colspan="4" align="center">特采需要风险评估</td>
        </tr>
        <tr>
          <td colspan="5">品控管理员：</td>
          <td colspan="4">品控经理：</td>
        </tr>
        <tr>
          <td rowspan="5" align="center">MRB评审</td>
          <td>采购部</td>
          <td colspan="5"></td>
          <td colspan="2">签名：</td>
        </tr>
        <tr>
          <td>生产部</td>
          <td colspan="5"></td>
          <td colspan="2">签名：</td>
        </tr>
        <tr>
          <td>研发部</td>
          <td colspan="5"></td>
          <td colspan="2">签名：</td>
        </tr>
        <tr>
          <td>工程部</td>
          <td colspan="5"></td>
          <td colspan="2">签名：</td>
        </tr>
        <tr>
          <td>品质部</td>
          <td colspan="5"></td>
          <td colspan="2">签名：</td>
        </tr>
        <tr>
          <td colspan="9">
            <div style="display:flex;justify-content: center;">
              <div>最终处理结果：</div>
              <a-radio-group :options="result"/>
            </div>
          </td>
        </tr>
        <tr>
          <td colspan="9">主管批准：</td>
        </tr>
      </table>
      </div>
    </a-card>
  </div>
</template>

<script>
export default {
  /** IQC来料检验报告 **/
  name: 'IQCIncomingInspectionReport',
  props:{
    reportData:{
      type:Object,
      default:()=>{}
    }
  },
  data(){
    return {
      checkedList:[
        { label: '电子', value: '电子' },
        { label: '五金', value: '五金' },
        { label: '塑胶', value: '塑胶' },
        { label: '包材', value: '包材' },
        { label: '辅料', value: '辅料' },
        { label: 'SMT外加工', value: 'SMT外加工' },
       ],
      hsf:[
        { label: '是', value: 'true' },
        { label: '否', value: 'false' },
      ],
      qualified:[
        { label: '合格', value: '合格' },
        { label: '不合格', value: '不合格' },
        { label: '待定', value: '待定' },
      ],
      result:[
        { label: '退货', value: '退货' },
        { label: '挑选', value: '挑选' },
        { label: '特采', value: '特采' },
      ]
    }
  }
}
</script>

<style scoped>

</style>